import React, {Component} from "react";
import store from '../store/index'

export default class TestRedux extends Component{
    componentDidMount() {
        store.subscribe(()=>{
            this.forceUpdate()
        })
    }

    render(){
        console.log(this)
        return <div>
            <h3>TestRedux</h3>
            <button onClick={()=>store.dispatch({type:'reduce',payload:100})}>减少</button>
            {store.getState().count}
            <button onClick={()=>store.dispatch({type:'add',payload:100})}>增加</button>
        </div>
    }
}
